import random
print("""
************************************
           唐人猜数小游戏
              欢迎您
************************************
""")
level = int(input("please input the level:(from 1 to 3)"))
if level == 1:
    luckynum= random.randint(1,30)
elif level == 2:
    luckynum = random.randint(1,50)
else:
    luckynum= random.randint(1, 100)
time = 0
guess = int(input("请输入你猜的数字："))

while True:
    if guess == luckynum:
        print("恭喜你猜对了")
        print(time)
        break
    else:
        print("猜错了")
        if guess>luckynum:
            guess = int(input("大了，请重新输入："))
            time += 1
        else:
            guess = int(input("小了，请重新输入："))
            time += 1